﻿using SRM.Application.PageResult.Dtos;
using SRM.Application.PageResult.IServices;
using SRM.Core.Models;
using SRM.Core.Models.Base;
using SRM.Core.Repositories;

using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace SRM.Application.PageResult.DeliverOrderPage
{
    public class DeliverOrderDtlServer : IDeliverOrderDtlServer
    {
        private readonly IRepository<DeliverOrderDetail> _deliverOrderDetailRepository;

        public DeliverOrderDtlServer(IRepository<DeliverOrderDetail> deliverOrderDetailRepository)
        {
            _deliverOrderDetailRepository = deliverOrderDetailRepository;
        }

        public async Task<PagerModel<DeliverOrderDetail>> GetDeliverOrderDtl(PagerModelInput input)
        {
            var query = await _deliverOrderDetailRepository.GetAllListAsync();
            PagerModel<DeliverOrderDetail> pagerModel =
                PagedList<DeliverOrderDetail>.PageList(input, query);
            return pagerModel;
        }
    }
}
